import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:lottie/lottie.dart';
import 'package:ruida_bottom_demo/app/components/lottie_icon.dart';
import 'package:svgaplayer_flutter/player.dart';

import '../../../../components/bottom9/bottom_app_bar_9.dart';
import '../controllers/bottom9_controller.dart';

class Bottom9View extends GetView<Bottom9Controller> {
  const Bottom9View({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('抖音、小红书'),
          backgroundColor: const Color(0xff111111),
          elevation: 0,
          centerTitle: true,
        ),
        backgroundColor: const Color(0xff111111),
        body: Stack(
          children: [content(), bottomBar()],
        ));
  }

  Widget content() {
    return Positioned.fill(
        child: Column(
      children: [
        const Center(
            child: SVGASimpleImage(
                assetsName: "assets/svga/menu_voice_match.svga")),
        Lottie.asset('assets/svga/json/square.json'),
        const LottieIcon(name: "assets/svga/json/square.json"),
        Container(
          alignment: Alignment.center,
          child: Obx(() {
            return Text(
              controller.pageIndex.value.toString(),
              style: TextStyle(color: Colors.grey[400], fontSize: 80),
            );
          }),
        ),
      ],
    ));
  }

  Widget bottomBar() {
    return Positioned(
        left: 0,
        right: 0,
        bottom: 0,
        child: BottomBar9(
            tabIconsList: controller.tabIconsList,
            changeIndex: (index) => controller.onClickBottomBar(index),
            addClick: () {
              debugPrint('点击了中间的按钮');
            }));
  }
}
